package net.tinyos.tools;
import net.tinyos.message.*;
import net.tinyos.packet.*;
import net.tinyos.util.*;
import net.tinyos.tools.*;
public class ListenLuoSensor{

public  String mainfunction(String args1,String args2)  {
 
		String str=args1+args2;
		int USBnum=0;
		
		String source = null;
			if (!args1.equals("-comm")) {
		//		usage();
				System.exit(1);
			}
			source = args2;
			if(source.charAt(19)!=':')
			{
				USBnum+=source.charAt(19)-'0';
				USBnum+=(source.charAt(18)-'0')*10;
			}else
			{
				USBnum=source.charAt(18)-'0';
			}
			
	
		PhoenixSource phoenix;
		if (source == null) {
			phoenix = BuildSource.makePhoenix(PrintStreamMessenger.err);
		}
		else {
			phoenix = BuildSource.makePhoenix(source, PrintStreamMessenger.err);
		}
//		System.out.print(phoenix);
		MoteIF mif = new MoteIF(phoenix);
		
		PrintLuo6 client = new PrintLuo6(mif,USBnum);
 		return str+"*"+USBnum;
}
  public static void main(String[] args)
{
	ListenLuoSensor t = new ListenLuoSensor();

	String str=t.mainfunction("-comm","serial@/dev/ttyUSB53:telosb");
	System.out.println("WSN~~~"+str);
}
}
